﻿Public Class License

    Private FLicenseID As Guid = Nothing

    Public Property LicenseID() As Guid
        Get
            If FLicenseID = Nothing Then Throw New ApplicationException("No ID has been set for this license.")
            Return FLicenseID
        End Get
        Set(ByVal value As Guid)
            If FLicenseID <> Nothing Then Throw New ApplicationException("An ID has already been set for this license.")
            FLicenseID = value
        End Set
    End Property

    Public Property Name As String = "Unnamed License"

    Public Property Details As String = String.Empty
    
    Public Property Number As String = String.Empty

    Public Sub New(ByVal licenseName As String)
        Me.Name = licenseName
    End Sub

    Public Overrides Function ToString() As String

        Dim Result As String = Name
        If Not String.IsNullOrEmpty(Number) Then Result += " (" + Number + ")"
        Return Result

    End Function

End Class
